package com.cow.support.dao;

import java.io.Serializable;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.cow.support.entity.Resourceinfo;

public interface ResourceDAO extends JpaRepository<Resourceinfo, Serializable>{
	@Query(value=" select distinct a.* "
			+ " from resourceinfo a,v_user_resourceinfo b where a.resourceid = b.resourceid and a.valid_flag=1"
			+ " and (a.systemid=:systemID or a.systemid='comm') and b.userid=:userID "
			+ " order by a.resourcetype,a.url,a.father_id,a.order_no ",nativeQuery=true)
	public List<Resourceinfo> getUserResource(@Param("userID")Integer userID,@Param("systemID")String systemID);	
	public List<Resourceinfo> findBySystemidAndResourcetype(String systemID,String resourceType);
}
